package com.zhangjie.servicemap.service;

import com.zhangjie.internalcommon.dto.ResponseResult;
import com.zhangjie.internalcommon.response.DirectionResponse;
import com.zhangjie.servicemap.remote.MapDirectionClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 根据起点和终点的经纬度获取距离（米）和时长（分钟）
 * @Auther: zj
 * @Date: 2024/2/6 - 02 - 06 - 14:37
 * @Description: com.zhangjie.servicemap.service
 * @version: 1.0
 */
@Service
public class DirectionService {

    @Autowired
    private MapDirectionClient mapDirectionClient;

    public ResponseResult driving(String depLongitude,String depLatitude,String destLongitude,String destLatitude){

        // 调用第三方地图接口
        DirectionResponse direction = mapDirectionClient.direction(depLongitude, depLatitude, destLongitude, destLatitude);

        return ResponseResult.success(direction);
    }
}
